package org.fisco.bcos.evidence.gateway.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description
 * @Author wx
 * @Date 2021/2/5 10:38
 */
public class DateUtil {
    public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static Date convertStrToDate(String dateStr) {
        Date date = null;
        try {
            date = sdf.parse(dateStr);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return date;
    }

    public static String convertTimeStampToStr(Long timeStamp) {
        return sdf.format(new Date(timeStamp));
    }
}
